package com.nuc.zyt.Dao.Impl;

import com.nuc.zyt.Dao.UserDao;
import com.nuc.zyt.Pojo.Student;
import com.nuc.zyt.Pojo.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

/**
 * @ClassName UserDaoImpl
 * @Description TODO
 * @Author 耀酱
 * @Date 2023/6/5 15:50
 * @Version 1.0
 */
@Repository
public class UserDaoImpl implements UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void create() {
        System.out.println("Dao代码执行");
    }

    @Override
    public Student getId(Integer id) {
        String sql = "select * from student where id = ?";
        return jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<Student>(Student.class), id);

    }
}
